' Increment the area of the background screen to be copied,
' remembering that the maximum Y position to go to is 480.
' This value is then put into Amreg(13) which is the AMAL
' register RN.
'
Inc LOP
LOP=Min(LOP,480)
Amreg(13)=LOP
'
' We must now make sure the program is "tuned" to the Amiga
' by waiting for the next vertical blank. This is a time
' when the electron gun of you monitor/TV moves from the bottom
' right hand corner of the screen, to the top left. If we did
' do this a visable flicker would disrupt our screen copied image.
'
Wait Vbl
Screen Copy 1,0,LOP,320,LOP+160 To Logic(2),0,0
'
' Bitmap collision using POINT command. Because AMOS offers no
' method to detect collisions between SPRITEs and BOBs, or
' between SPRITEs and the background landscape I look at
' six specific around the ship to see if a "foriegn" (eg. not
' part of the ship) colour is there.
'
X=X Screen(1,X Sprite(15))
Y=Y Screen(1,Y Sprite(15))
BANG1=Point(X,Y)
BANG2=Point(X+7,Y+2)
BANG3=Point(X+1,Y+4)
BANG4=Point(X+7,Y+18)
'
BANG5=Point(X+2,Y+10)
BANG6=Point(X+7,Y+10)
'
' If the program detects a collision and we decide to blow up
' the ship, the AMAL program which controls it must be informed!
' This is done by passing the value of 1 into the AMAL register
' RZ (or Amreg(25) if you prefer).
'
If((BANG1>0 and BANG1<11) or(BANG2>0 and BANG2<11) or(BANG3>0 and BANG3<11) or(BANG4>0 and BANG4<11) or(BANG5>0 and BANG5<11) or(BANG6>0 and BANG6<11)) and CHEAT=0
Amreg(25)=1
Sam Play 2,2
End If
'
' To launch a missile we must first determine if the fire button
' has been pressed. The ship's AMAL program will put a value of
' 1 into Amreg(0) (RA) if this event occurs. There are eight
' missiles, each one has an AMAL register which tells the main
' program whether it is busy or not, these are Amreg(1) to Amreg(8).
' If a missile is already in flight its external register will
' contain the value 100 and the main program will not be able to
' use it.
'
If Amreg(0)=1 and Amreg(LAUNCHED)=100 and Fire(1)
Amreg(LAUNCHED)=1
Amreg(0)=0
Sam Play 2,1
Amreg(21)=1
End If
Add LAUNCHED,1,1 To Amreg(20)
'
' These lines allow the program to perform all of its housekeeping
' and synchronise all of the BOB movements. It also allows us to
' have more than 16 AMAL channels.
'
Synchro
Update
'
' This line is the end of the loop. If the end of level is
' reached and the player docks the ship OR Amreg(24)=99 we finish.
' Amreg(24) is set when the AMAL program controlling the ship
' has finished the animation to blow up the players ship.
'
Amreg(21)=0
Screen 5
Paste Bob 0,0,59
Ink 2,0 : Text 59,17,Str$(LIVES) : Text 150,17,Str$(LEVEL) : Text 239,17,Str$(SCORE)
SCORE=Amreg(9)
Screen 2
Until(Zone(1,X+4,Y+LOP+10)=1 and LOP>479) or Amreg(24)=99
'
' If the level has been completed the players ship must be rotated
' ready for the next horizontal level!
'
If Amreg(24)<>99
Amal Off 15
Wait 3
Screen Copy 1,LOP,0,LOP+320,160 To Logic(2),0,0
Synchro
Update
For L=22 To 20 Step -1
Wait 3
Screen Copy 1,LOP,0,LOP+320,160 To Logic(2),0,0
Sprite 15,,,L
Synchro
Update
Wait 3
Next L
Wait 5
Screen Copy 1,LOP,0,LOP+320,160 To Logic(2),0,0
Sprite 15,,,2
Synchro
Update
FIN_LEVEL=True
Else
Dec LIVES
End If
'
' Finally, if you run out of lives or actually finish the level
' this line ends the large loop and returns control back to the
' main program.
'
Until LIVES=0 or FIN_LEVEL=True
End Proc
Procedure HORIZ_MAIN_LOOP
Repeat
If LEVEL=1
LEVEL1
End If
If LEVEL=3
LEVEL3
End If
If LEVEL=5
LEVEL5
End If
CLEAR_AMAL
HORIZONTAL_SHIP
Amal On
'
' Init level variables
'
THUNDER=0
BANG1=0
BANG2=0
BANG3=0
BANG4=0
BANG5=0
BANG6=0
LOP=-1
FIN_LEVEL=False
'
' Make sure correct screen is showing
'
Screen 2
Get Palette 1
Screen To Front 2
'
' Start scrolling loop for this level
'
Repeat
'
' Increment the area of the background screen to be copied,
' remembering that the maximum X position to go to is 640.
'This value is then put into Amreg(13) which is the AMAL
' register RN.
'
Inc LOP
LOP=Min(LOP,640)
Amreg(13)=LOP
'
' These lines control the thunder and lightning.
' A random number is first generated, if it is equal to 1
' I fade the background colour ( which is colour(0) )
' to bright white ($FFF). When the sample has started to play
' a value of 1 is put into the variable THUNDER. This is a flag
' which will tell the next part of the program to fade the screen
' background to black again.
'
' If Rnd(200)=1 and Timer>100 and LOP<639
'
' Amreg(21)=1
'� Fade 1,$F00
' Timer=0
'� THUNDER=1
' End If
' If THUNDER=1 and Timer>10
' THUNDER=0
' Fade 1,$0
'� ' Timer=0'
'�' End If
'
' We must now make sure the program is "tuned" to the Amiga
' by waiting for the next vertical blank. This is a time
' when the electron gun of you monitor/TV moves from the bottom
' right hand corner of the screen, to the top left. If we did
' do this a visable flicker would disrupt our screen copied image.
'
Wait Vbl
Screen Copy 1,LOP,0,LOP+320,160 To Logic(2),0,0
'
' Bitmap collision using POINT command. Because AMOS offers no
' method to detect collisions between SPRITEs and BOBs, or
' between SPRITEs and the background landscape I look at
' six specific around the ship to see if a "foriegn" (eg. not
' part of the ship) colour is there.
'
X=X Screen(2,X Sprite(15))
Y=Y Screen(2,Y Sprite(15))
BANG1=Point(X,Y)
BANG2=Point(X+14,Y+2)
BANG3=Point(X+2,Y+8)
BANG4=Point(X+18,Y+8)
'
BANG5=Point(X+9,Y+2)
BANG6=Point(X+9,Y+8)
'
' If the program detects a collision and we decide to blow up
' the ship, the AMAL program which controls it must be informed!
' This is done by passing the value of 1 into the AMAL register
' RZ (or Amreg(25) if you prefer).
'
If((BANG1>0 and BANG1<11) or(BANG2>0 and BANG2<11) or(BANG3>0 and BANG3<11) or(BANG4>0 and BANG4<11) or(BANG5>0 and BANG5<11) or(BANG6>0 and BANG6<11)) and CHEAT=0
Amreg(25)=1
Sam Play 2,2
End If
'
' To launch a missile we must first determine if the fire button
' has been pressed. The ship's AMAL program will put a value of
' 1 into Amreg(0) (RA) if this event occurs. There are eight
' missiles, each one has an AMAL register which tells the main
' program whether it is busy or not, these are Amreg(1) to Amreg(8).
' If a missile is already in flight its external register will
' contain the value 100 and the main program will not be able to
' use it.
'
If Amreg(0)=1 and Amreg(LAUNCHED)=100 and Fire(1)
Amreg(LAUNCHED)=1
Amreg(0)=0
Sam Play 2,1
Amreg(21)=1
End If
Add LAUNCHED,1,1 To Amreg(20)
'
' These lines allow the program to perform all of its housekeeping
' and synchronise all of the BOB movements. It also allows us to
' have more than 16 AMAL channels.
'
Synchro
Update
'
' This line is the end of the loop. If the end of level is
' reached and the player docks the ship OR Amreg(24)=99 we finish.
' Amreg(24) is set when the AMAL program controlling the ship
' has finished the animation to blow up the players ship.
'
Amreg(21)=0
Screen 5
SCORE=Amreg(9)
Paste Bob 0,0,59
Ink 2,0 : Text 59,17,Str$(LIVES) : Text 150,17,Str$(LEVEL) : Text 239,17,Str$(SCORE)
Screen 2
Until(Zone(1,X+LOP+7,Y+4)=1 and LOP>639) or Amreg(24)=99
'
' If the level has been completed the players ship must be rotated
' ready for the next horizontal level!
'
If Amreg(24)<>99
If LEVEL<6
Amal Off 15
Wait 3
Screen Copy 1,LOP,0,LOP+320,160 To Logic(2),0,0
Synchro
Update
For L=20 To 22
Wait 3
Screen Copy 1,LOP,0,LOP+320,160 To Logic(2),0,0
Sprite 15,,,L
Synchro
Update
Wait 3
Next L
End If
FIN_LEVEL=True
Else
Dec LIVES
End If
'
' Finally, if you run out of lives or actually finish the level
' this line ends the large loop and returns control back to the